<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="mvc" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.divForm{
position: absolute;
border: 1px solid red;
text-align: center;
top: 50%;
left: 50%;
margin-top: -200px;
margin-left: -150px;
border-width: 0px;
}
</style>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="${ctx}/static/js/jquery.min.js"></script>
<script type="text/javascript">
$(function() {

	$("input[type='submit']").click(function(){
	
		if($("#us").val()==""){
			alert("用户名不能为空！");
			return false;
		}
		if($("#pd").val()==""){
			alert("密码不能为空！");
			return false;
		}
		if($("#age").val()==""){
			alert("年龄不能为空！");
			return false;
		}
		
	})

}
);
</script>
<body>
	<div class="divForm">
	<mvc:form action="${ctx}/user" method="POST" modelAttribute="user">
		<mvc:hidden path="id"/>
		用户名：<mvc:input path="username" id="us"/><br/>
		密&emsp;码：<mvc:input path="password" id="pd"/><br/>
		年&emsp;龄：<mvc:input path="age" id="age"/><br/>
		<input type="submit" value="提交" />
	</mvc:form>
</div>
</body>
</html>